﻿@model Model.SysRoleInfo
@{
    ViewBag.Title = "RoleEdit";
    Layout = "~/Views/Shared/_Main.cshtml";
}
<link href="../../CSS/PageStyle.css" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<style type="text/css">
    textarea
    {
        width: 400px;
        border: 1px solid #ccc;
        padding: 2px;
    }
</style>
<script type="text/javascript">
    function SubmitForm() {
        if ($('#ff').form("validate")) {
            $('#ff').form('submit');
            back();
        }
    }
    function back() {
        window.location.href = "/SysRole/RoleList";
    }

    function ChickCode() {
        var v = $("#txt_Code").val();
        $.post("/SysRole/ChickCode?code=" + encodeURI(v), function (result) {
            if (result > 0) {
                $("#checkCode").html("该值己存在，请重输入！");
                $("#Save").attr("disabled", "disabled");
                //                $("#checkCode").
            } else {
                $("#Save").removeAttr("disabled", "disabled");
            }
        });
    }
    $(function () {
        if ($("#hid_Guid").val() != "") {
            $("#txt_Code").attr("readonly", "true");
            $("#txt_Code").removeAttr("onblur");
        }
    });
</script>
<div style="margin: 5px;">
    <div id="p" class="easyui-panel" style="width: 600px; padding: 10px 5px 10px 5px;"
        data-options="title:'角色信息编辑',iconCls:'icon-edit'">
        <form id="ff" action="/SysRole/UserUpdate" method="post">
        <table style="width: 580px" cellpadding="0" cellspacing="0" class="table_bg">
            <colgroup>
                <col style="width: 27%;" />
                <col style="width: 73%;" />
            </colgroup>
            <tr>
                <td style="text-align: right;">
                    编码：
                </td>
                <td>
                    <div style="float: left">
                        <input id="hid_Guid" type="hidden" name="Id" value="@Model.Id"/>
                        <input type="text" id="txt_Code" name="Code" value="@Model.Code" class="easyui-validatebox" data-options="required:true" onblur="ChickCode()"/>
                    </div>
                    <div id="checkCode" style="float: left; color: red">
                    </div>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    名称：
                </td>
                <td>
                    <input type="text" id="txt_PhoneNumber" name="Name" value="@Model.Name" class="easyui-validatebox" data-options="required:true"/>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    描述：
                </td>
                <td>
                    <textarea id="TextArea1" cols="30" rows="3" name="Description" class="easyui-validatebox"
                        data-options="required:true">@Model.Description</textarea>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    状态：
                </td>
                <td>
                    @Html.DropDownListFor(model => model.Status, WebPortal.Controllers.SystemConfigurationController.DropDownStatus(), "--请选择--")
                </td>
            </tr>
            <tr>
                <td style="border-top: 0px; text-align: center" colspan="2">
                    <input id="Save" type="button" value=" 保存 " onclick="SubmitForm()" />
                    <input type="button" value=" 返回 " onclick="back();" />
                </td>
            </tr>
        </table>
        </form>
    </div>
</div>
